package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JRootPane;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import java.awt.Dimension;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.util.HashMap;

import javax.swing.JList;

import code.Language;
import code.Settings;

public class FileEncryption extends JPanel {
	
	Color c= new Color(0x80, 0x80, 0xFF);

	private static final long serialVersionUID = 1L;

	private HashMap labels;

	private JLabel jLabel = null;
	
	String[] listEntries = {"AES", "DES", "TripleDES", "RC2", "RC4", "RC5","RC6", "Blowfish", "Serpent"};

	private JList jList = null;

	ATOCOmain atocoframe;
	
	int selected;

	private JLabel jLabel1 = null;

	/**
	 * This is the default constructor
	 */
	public FileEncryption(ATOCOmain atocoframe) {
		super();
		Settings s = new Settings();
		Language l = new Language();
		labels = l.changeLanguage((String) s.global.get("language"), "FileEncryption", (String) s.global.get("installPath"));
		initialize();
		this.setPreferredSize( new Dimension( 400, 550 ) );
		this.atocoframe=atocoframe;
	   
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		ImageIcon symhelp = new ImageIcon((String) labels.get("symhelp"));
		jLabel1 = new JLabel(symhelp);
		jLabel1.setBounds(new Rectangle(324, 70, 483, 382));
		this.setSize(900, 550);
		jLabel = new JLabel();
		jLabel.setBounds(new Rectangle(14, 32, 350, 28));
		jLabel.setText((String) labels.get("jLabel"));
		//jLabel.setForeground(c);
		this.setLayout(null);
		this.add(jLabel, null);
		this.add(getJList(), null);
		this.setBackground(Color.WHITE);
		this.add(jLabel1, null);
	}

	
	private JList getJList() {
		if (jList == null) {
			jList = new JList(listEntries);
			jList.setForeground(c);
			jList.setFont(new java.awt.Font("Comic Sans MS", Font.BOLD, 14));
			jList.setBounds(new Rectangle(29, 95, 100, 250));
		
			jList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
				public void valueChanged(javax.swing.event.ListSelectionEvent e) {
					int index=jList.getSelectedIndex();
					switch(index){
					case 0: atocoframe.contentPane(new AESEncryptionMode(atocoframe));
					break;
					case 1: atocoframe.contentPane(new DESEncryptionMode(atocoframe));
					break;
					case 2: atocoframe.contentPane(new TripleDESEncryptionMode(atocoframe));
					break;
					case 3: 
						selected=2;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					case 4: 
						selected=3;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					case 5: 
						selected= 4;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					case 6: 
						selected = 5;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					case 7:
						selected= 1;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					
					case 8: 
						selected = 0;
						atocoframe.contentPane(new OtherEncryptions(atocoframe, selected));
					break;
					}
				}
			});
			
		}
		return jList;
	}
	


}  //  @jve:decl-index=0:visual-constraint="10,10"
